package com.honglang.module.article.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.honglang.module.user.entity.User;

@Entity
@Table(name="comment")
public class BlogArticleComment {

	/**
	 * @uml.property  name="id"
	 */
	private Integer id;

	/**
	 * @uml.property name="Content"
	 */
	private String content;

	/** 
	 * @uml.property name="author"
	 * @uml.associationEnd aggregation="shared" inverse="comment:com.honglang.entity.User"
	 */
	private User author;

	/**
	 * @uml.property name="commentDate"
	 */
	private Date commentDate;

	
	
	/**
	 *  the comment which this comment comments;
	 */
	private BlogArticleComment toComment;
	
	
	/**
	 *  the BlogArticle Which this comment belong;
	 */
	private BlogArticle blogArticle;
	
	
	/**
	 * the comment which is the root of this comment thread;
	 */
	private BlogArticleComment rootComment;
	
	
	/**
	 * is display the comment ? display if true . hide if false
	 */
	private boolean display;
	
	private Date lastEditDate;
	
	/**
	 * Getter of the property <tt>Content</tt>
	 * 
	 * @return Returns the content.
	 * @uml.property name="Content"
	 */
	@Column(length=5000)
	public String getContent() {
		return content;
	}

	/**
	 * Setter of the property <tt>Content</tt>
	 * 
	 * @param Content
	 *            The content to set.
	 * @uml.property name="Content"
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * Getter of the property <tt>commentDate</tt>
	 * 
	 * @return Returns the commentDate.
	 * @uml.property name="commentDate"
	 */
	@Column
	public Date getCommentDate() {
		return commentDate;
	}

	/**
	 * Setter of the property <tt>commentDate</tt>
	 * 
	 * @param commentDate
	 *            The commentDate to set.
	 * @uml.property name="commentDate"
	 */
	public void setCommentDate(Date commentDate) {
		this.commentDate = commentDate;
	}

	/** 
	 * Getter of the property <tt>author</tt>
	 * @return Returns the author.
	 * @uml.property name="author"
	 */
	@ManyToOne(fetch=FetchType.EAGER)
	public User getAuthor() {
		return author;
	}

	/** 
	 * Setter of the property <tt>author</tt>
	 * @param author The author to set.
	 * @uml.property  name="author"
	 */
	public void setAuthor(User author) {
		this.author = author;
	}

	/**
	 * Getter of the property <tt>id</tt>
	 * @return  Returns the id.
	 * @uml.property  name="id"
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	/**
	 * Setter of the property <tt>id</tt>
	 * @param id  The id to set.
	 * @uml.property  name="id"
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn
	public BlogArticleComment getToComment() {
		return toComment;
	}

	public void setToComment(BlogArticleComment toComment) {
		this.toComment = toComment;
	}
	
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn
	public BlogArticle getBlogArticle() {
		return blogArticle;
	}

	public void setBlogArticle(BlogArticle blogArticle) {
		this.blogArticle = blogArticle;
	}
	
	
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn
	public BlogArticleComment getRootComment() {
		return rootComment;
	}

	public void setRootComment(BlogArticleComment rootComment) {
		this.rootComment = rootComment;
	}
	
	@Column
	public boolean isDisplay() {
		return display;
	}

	public void setDisplay(boolean display) {
		this.display = display;
	}
	
	@Column
	public Date getLastEditDate() {
		return lastEditDate;
	}

	public void setLastEditDate(Date lastEditDate) {
		this.lastEditDate = lastEditDate;
	}
	
	
	
	

}
